<?php
/**
 * This helps build links. Pass in a label and a url and it will build the link
 * @todo Right now this requires something like $this->link("Click Here", $this->url(foo, bar));
 *       I want it to accept the url helper's params instead of the url helper. So it would look like
 *       $this->link("Click Here", "route_name", array("route" => "params"), $attribs, $escapeLabel)
 */
class ImpSoft_View_Helper_Link extends Zend_View_Helper_FormElement {

    public function link($label, $href, $attribs = false, $escapeLabel = true) {
    
        if ($attribs) {
            if (isset($attribs['href'])) unset($attribs['href']);
            $attribs = $this->_htmlAttribs($attribs);
        } else {
            $attribs = '';
        }
        
        $tag = "a";
        $href = " href=\"" . $href . "\"";
        $label = ($escapeLabel) ? $this->view->escape($label) : $label;
        return '<' . $tag . $href . $attribs . '>' . $label . '</' . $tag . '>';
    
    }

}